package com.byt.framlib.commonwidget.finder.helper;

import android.content.Context;

import com.byt.framlib.commonutils.ConvertUtils;
import com.byt.framlib.commonwidget.finder.entity.Province;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by tom on 2018/3/21.
 */

public class AddressHelper {

    public static ArrayList<Province> getAddressProvice(Context context) {
       ArrayList<Province> data = new ArrayList<>();
         try {
            String json = ConvertUtils.toString(context.getAssets().open("city.json"));
            Gson mGson = new Gson();
            List<Province> list = mGson.fromJson(json, new TypeToken<List<Province>>() {
            }.getType());
            data.addAll(list);
        } catch (java.io.IOException e) {
            e.printStackTrace();
        }
//        ArrayList<Province> mData = (ArrayList<Province>) ACache.get(context).getAsObject(BaseConst.ADDRESS_CASHE_XMXB);
//        if (mData != null && mData.size() > 0) {
//            data.addAll(mData);
//        }
        return data;
    }
}